If I declare a variable const char ** stringTable, how should I be able to put values to it if it is a const? (It has to be const because a ... |
I have assign the value of a member variable as under:
myValue = (char*)malloc(strlen(inValue) * sizeof(char));
strcpy(mValue, inValue);
while assigning it the value was proper as(taking printf output):
http://www.w3.org/2001/XMLSchema
But, when i get its value after ... |
#include <stdio.h>
int main()
{
unsigned char i=0x80;
printf("%d",i<<1);
return 0;
}
Why does this program print 256?
As I understand this, since 0x80= 0b10000000, and ... |
Is it possible to store more than a byte value to a char type?
Say for example char c; and I want to store 1000 in c. is it possible to do ... |
I have an unsigned char and I need to check bits 1 and 2 to find the status. What is the best way to determine the last 2 bits?
I am attempting ... |
I need to convert integer value to char value in C. What is the proper way to do it ?
Regards...
|
I don't understand how I can get mpz_t type variable into char*. I've tried many functions, but my char* stays empty.
I can output my B variable:
mpz_t B;
gmp_printf("B: %Zx\n", B);
But how to ... |
|
In C, I can use the preprocessor to convert a enum to its string equivalent.
But is there any clever trick to convert a char* to a enum.
I can use ... |
Thank you for your replies. Array my_char_array[] is an array of char initialized to zeros. The only value to be set by the threads is 1. I do want to avoid using mutex variables. I'm working on the LU factorization of large sparse matrices. Each thread works with a set of rows. While working a row, a thread tags only a ... |
Is the following appropriate behavior? It certainly isn't what I expected. #include using namespace std; template(10) ); } $ CC test.C "test.C", line 14: Error: Overloading ambiguity ... |
On Mar 24, 1:12 pm, "parag_p...@hotmail.com" wrote: Why is gcc allowing the following compilations > #include #include main(){ const char* str; str =(char*) malloc(12); strcpy(str,"partas"); *str= 'q'; printf(" the string is %s\n", str); > } > It is compiling with a warning only . why is it not giving a compile time error Perhaps you have an old ... |
On 2006-03-27, sam_cit@yahoo.co.in wrote:[color=blue] > Hi, > I needed help in converting a character to the correspoding > hexadecimal values, like the following example, > ASCII value : ABC > Hex Code Value : %41%42%43... > > whats the logic of conversion... >[/color] 1) learn how to step along a string e.g for(int i=0;i |
|
|
|
#include #include #include struct characters { int count; char (*value)[20]; }; int main(int argc, char *argv[]) { struct characters c; c.value = malloc(sizeof *c.value); if ( c.value ) { strcpy(*c.value, "this_is_a_string"); puts(*c.value); (*c.value)[0] = 'T'; (*c.value)[5] = 'T'; puts(*c.value); free(c.value); } return 0; } /* my output this_is_a_string This_Ts_a_string */ |
I have tried to find an answer to this for a couple of hours with no luck. It's probably something really simple but here it goes. I am building a search program which searches a file (which is supplied as one of the arguments) for a word/pattern I imput as one of the other arguments. The problem I have is that ... |
|
#include #include #include #include #include #include #include #include int main(void) { FILE *fp; char filename[20]; char *test; char folder1[20] = ""; char buf1[80]; char buf2[80]; time_t filecreate; struct tm *ptr; struct _finddata_t c_file; long hfile; if ((hfile = _findfirst("C:\\Program Files\\Microsoft Visual C++ Toolkit 2003\\samples\\*.out",&c_file)) == 1L) printf("a"); else { printf("%-12s %.24s % 9ld\n",c_file.name,ctime(&(c_file.time_write)),c_file.size); ... |
I have written a function which receives a char variable and checks it's int value for certain restrictions, but when I try to compare it with -1 it doesnt work and I don't know why. can anyone help me please? void INIT(int poly[]){ int i=-1, n; const MAX=10; char temp, power; for (n=1;n<=MAX;n++){ /* stops after 9 good entries */ printf("Enter ... |
Hi. Im making an encryption class from some C code that I pulled out of the libmcrypt source. I am stuck on a problem though... I think that the difference between the way that PHP and C handles chars in strings is causing me problems. In C, if you do a = "a"; a = a + 1; a will have ... |
I want to know how to put two char values together.... The values are read in as chars from a file with letters and numbers.. I use isdigit (ch) to detect a number.... but now I want to put them togther ot get the original number. I.E: values of file MUNGFHG85NMNN I read in each character one at a time, but ... |
Under Win32, this macro expands to nothing and is provided for backward compatibility. Under 16-bit MFC, the macro ensures that data will be placed in the code segment rather than in the data segment. The result is less impact on your data segment. See this http://msdn.microsoft.com/en-us/library/17zhcawf(v=vs.80).aspx[] So in either case its just ... |