Technology (Read Only) > Programming

C, C++ and C# tutorials

<< < (7/9) > >>

Сєşάя:
I bought my C book last month, very good book, I know now how to manipulate strings:

char name[256];

printf("Tell me your name: ");
scanf("%s", name);
printf("Hello %s", name);

Travelsonic:
One thing I'd get proficient in is dynamic memory allocation -> that way you aren't creating containers that waste space since the unknown of how much space you needs is currently forcing you to create containers or variables that take up more space than what may be needed.

ursus:

--- Quote from: César on October 08, 2011, 10:19:41 AM ---I bought my C book last month, very good book, I know now how to manipulate strings:

char name[256];

printf("Tell me your name: ");
scanf("%s", name);
printf("Hello %s", name);

--- End quote ---

wouldn't str name make more sense?

Tomcat:

--- Quote from: gamefreak171 on October 24, 2011, 04:15:39 PM ---wouldn't str name make more sense?

--- End quote ---

doesnt rly matter

but yes

Travelsonic:

--- Quote from: Tomcat on October 24, 2011, 05:25:50 PM ---doesnt rly matter

but yes

--- End quote ---

Depends - I mean, yes, it is an array of character arrays - which usually makes up a string, but at the same time the variable name makes the programmer perfectly aware of its intended use, I guess.  nameStr, IMO, would be best - the name gives it away as an array of characters [acting as a string] that stores someone's name.  :D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version