Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

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

OpenStudy (anonymous):

You can use string in C, just include the library string.h

OpenStudy (anonymous):

ther's something called string datatype?

OpenStudy (anonymous):

Yeah, as I know you can write as follow : #include<string.h> #include<stdio.h> int main(){ string name; scanf("%s", &name); }

OpenStudy (anonymous):

really i l check that....... i never read about this before -.- it's in c? or c++

OpenStudy (anonymous):

i get a compile time error i dont think ther's a datatype called string in c

OpenStudy (anonymous):

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.

OpenStudy (anonymous):

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

OpenStudy (anonymous):

Ah haha I don't have an idea!

OpenStudy (anonymous):

hmm ok .........may be i l be able to do this after some practise -.-

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!