C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 02-07-2010, 11:07 PM   #1
Registered User
 
Join Date: Feb 2010
Posts: 67
printing out strings

hi i am trying to print out string are this sysntax wrong is this how i declare [i] or do i use int iam a beginner just trying to experiment
Code:
 
char scores[50], i;
printf("enter name");
scanf("\n%s", scores[i]);
printf("\n%s",scores[i]);
mouse666666 is offline   Reply With Quote
Old 02-08-2010, 12:03 AM   #2
C++ Witch
 
laserlight's Avatar
 
Join Date: Oct 2003
Location: Singapore
Posts: 12,459
Your syntax is fine. What is wrong is that you should pass scores, not scores[i] to scanf and printf. In fact, you should not use i because it has not been initialised.
__________________
C + C++ Compiler: MinGW port of GCC
Build + Version Control System: SCons + Bazaar

Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
laserlight is offline   Reply With Quote
Old 02-08-2010, 12:27 AM   #3
Registered User
 
UltraKing227's Avatar
 
Join Date: Jan 2010
Location: USA, New york
Posts: 123
i agree with laserlight.
UltraKing227 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
printing strings Tom_Arch C Programming 4 04-25-2009 03:23 AM
printing wide characters to strings... davo666 C Programming 1 02-21-2009 12:56 AM
printing char* strings difficult.name C Programming 4 12-10-2004 07:06 PM
printing strings (was similar problem) weirdbeardmt C Programming 5 06-01-2004 01:12 PM
printing an array of strings linucksrox C Programming 3 05-11-2004 03:31 PM


All times are GMT -6. The time now is 12:06 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22