Computing.Net > Forums > Programming > C set variable

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C set variable

Reply to Message Icon

Name: wille
Date: April 17, 2009 at 03:37:24 Pacific
OS: Microsoft Windows Vista Home Premium
CPU/Ram: 2 GHz DualCore/ 2041 MB
Product: Lenovo / 42334dg
Subcategory: C/C++
Comment:

Hi, I was wondering if it's possible to set a variable like this;
char a[20];
char b[20] = "Whatever";
a = ("%s", b);

just like the way printf works. it's the way a is set im going for.

Live the life as you know it
/ Wille



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: April 17, 2009 at 08:03:49 Pacific
Reply:

If you want to do format some variables and output the text into a string variable instead of a file/screen, you can use sprintf.


0

Response Number 2
Name: wille
Date: April 17, 2009 at 08:16:15 Pacific
Reply:

Ok i'll try that thanks.

Live the life as you know it
/ Wille


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C set variable

off set variables....?? www.computing.net/answers/programming/off-set-variables/1023.html

C++ setting and getting members www.computing.net/answers/programming/c-setting-and-getting-members/6792.html

Setting variables from a txt file www.computing.net/answers/programming/setting-variables-from-a-txt-file/15639.html