It seems scanf is getting called first ..could you post the whole code.. I mean your main function and when you are calling writemenu() function as well! .
Type: Posts; User: vandrea
It seems scanf is getting called first ..could you post the whole code.. I mean your main function and when you are calling writemenu() function as well! .
Thanks a lot Ben that made things clear:)
Thanks Ben for your reply. Yes I got what you said !
But have certain things still on my mind still. Sorry abt that though!
So if a do a string comparision on both of these character arrays, ...
What in case I have an array name different for the second one I mean say,
char arr1_ca[0]='Y';
char arr1_ca[1]='E';
char arr1_ca[2]='S';
However the first remains the same thats
hi there,
Is there any difference between these two kind of storage of characters in C
char array_ca[10]={"YES"};
OR
I guess you would require to do a memset on both of these character arrays before you actually use it...Can you just give it a try?
quzah i did not get your point. isnt 5 sufficient since we would store only exit and a null character at the end , i thought it would be enough?
As tabstop said probably u could use strncmp. Follg is the code thou a littl longer I guess
char exit_ca[5];
memset(exit_ca, 0x00, 5);
strncpy(exit_ca, "exit", 5);
if(ZERO == strncmp(buff,...
Ya thats right. I have now corrected it. Thanks.
Well fiendslyr this is a pretty stright forward question.
>> After you are done either your printf probably you could ask the user for his input - Choice of operation (Done thru scanf function)...
Hi,
I have a query wrt character array. Follg is the basic code
void main()
{
char a[10];
for(i=0;i<10;i++)
got it now...thks elysia
considering the fact that abc_ca is filled with some data for first 10 characters say "ABCDEFGHIJ"
thks for quick reply Elysia!!
Just to get my understanding right i have an eg here...
char abc_ca[10];
char def_ca[15];
Hello ppl,,
I would like to know the basic diff between sprintf and memcpy tho i know the syntax of each of these functions....I am interested on functional behaviour of both of these,,,thks in...
as tabstop said usage of scanf stmt on line 12 is wrong when it should have been scanf("%d", &i) instead of scanf("&d", &i) !!
Thanks guys!
Thanks bithub for ur reply ..
I did intend to use memcpy to know its behaviour while copying the data . But how is the random value coming since I would have done memset earlier and all the...
Sorry this should have been memcpy on line no 4 i.e.
memcpy(arr_ca, "Checking the text", ARR_LEN); instead of memset
I am assigning the character array with sum value!!
I have used memcpy in...
I get 101
Hi guys,
I had an issue wrt memcpy in my code...Pls find the snippet of code below
#define ARR_LEN 100
char arr_ca[ARR_LEN + 1 ];
Thanks Sebastiani...Now I get it!
I understood ur example but still wondering as to y cant we use sizeof in the above memset since
sizeof(abc_ca) wuld return 3 I guess..
Thanks Sebastiani for the quick reply...but dint get as to why cant we use sizeof in memset ?
yep u were right..i meant of the integral constant!
Consider the follg eg:
char abc_ca[3];
memset(abc_ca,0x00,size(abc_ca));
So after the above memset i would have following values in...