i was wondering if there is a way to define a datatype called string in c say like typedef char[some #] string; but the above one doesnt work so is there any method like this? use of structures is a waste of time
You can use string in C, just include the library string.h
ther's something called string datatype?
Yeah, as I know you can write as follow : #include<string.h> #include<stdio.h> int main(){ string name; scanf("%s", &name); }
really i l check that....... i never read about this before -.- it's in c? or c++
i get a compile time error i dont think ther's a datatype called string in c
Sorry, yes you are right. I get confused. But like that it works. #include<string.h> #include<stdio.h> #include<stdlib.h> int main(){ char name[10]; scanf("%s", &name); printf("%s\n", name); system("pause"); } Well like that it helps you to avoid the treatment of array of char.
yea i am sure this works but i want to define some abstract data type called string in c........ actually i thot it wud be easy guess not
Ah haha I don't have an idea!
hmm ok .........may be i l be able to do this after some practise -.-
Join our real-time social learning platform and learn together with your friends!