- 2
I want to print my name in c language using a data type
Help me
18 Réponses
+ 3
the data type "string" doesn't exist in C. Use array of chars.
https://www.sololearn.com/learning/2936/
+ 3
No, figure it out yourself.
+ 3
#include <stdio.h>
int main(void)
{
char name[25] ;
printf("what's your name ?") ;
scanf("%s", name) ;
printf ("your name is %s", name) ;
return 0 ;
}
+ 2
You can do it with the help of array of character
+ 1
Thanks bro
0
char nm[20];
fgets(nm, sizeof(nm), stdin);
printf("%s", nm);
0
It's wrong bro
0
Thanks bro
0
Some good examples listed.
If it is just your name no need to take in the input
#include <stdio.h>
int main(void){
char *myName = "Put your name here";
printf("My name is %s.\n", myName);
}
In this example changing the value of myName is not strait forward because it is considered a string literal. Like someone stated however there are no strings in C, all strings are arrays of chars, but the updated C Standard does reference "string literal".
0
devaraj%s
- 1
Coding is done in python is easier than c language
- 3
Can you write it and send please
- 3
Can any one send code
- 3
Console.writeline("name")