Raja I told you to read the whole posts! If you to post number 4, you see that I said to use
%s for strings in scanf !
Glad you have no errors :)
Type: Posts; User: std10093
Raja I told you to read the whole posts! If you to post number 4, you see that I said to use
%s for strings in scanf !
Glad you have no errors :)
As Adak said, you have to do that AND to have enough space in your arrays.
This
char grade_electronics[1];
can have only one character!!!! And what about the null terminator of the strings...
Adak, I have already "liked" it ;)
@Raja, too many said, take a 5min break and think of what was said. Then try to debug :)
In C, we can not assign a variable with a string by the equal (=) operator.
We have to use functions from string.h, like strcpy.
Or you have to do it as Adak said.
Adak, I guess google...
That's exactly an array of 20 characters :)
As far as I know, this
char name[20];
is an array of 20 characters.
One more beginner's tip :
Read the whole posts. The words are there, because they have something to say.
When you are asked about something, answer honestly!
You said you changed what I said, but...
Did you change what I said?
Ok, beginner's tips about to come :)
We write
int main(void) and not
void main()
When you want to read a string into a char array you do it like this
scanf("%s", name);
Welcome to the forum!!
Of course, here there are many very good programmers, who, for sure, can say something about every code they see!
Post your code in code tags
/*your program*/
replace...