No it is a Big no in school you can do alot with string and also manipluating 
string let me show you how to innitialize string it is perfect but you have to 
bear in mind  in C you have to declare array size before you can use string and 
also the data type should be char this works perfectly good.... let do some 
small innitializatin without using the get and the put
char array_name [size];
char array_name [6]= {'h','e','l','l','o','\0'} this is the code remember that 
in C in string you have to state the NULL that is the \0 this terminate the 
array string also let do a print out.
printf("%s",&array_name[0]);
but the short form for this is
printf("%s", array_name);
if you want me to explain just tell me so i can explain but it is long to 
explain that will take about multi lines. let me show you some muti Line string 
this is the code
char array_name [60];
printf("%[^\n]s",array_name);
this is the array code hope this answer your question.. GudLuck Stay bless 
byeeeeeee.

Prince Annan Koomson

--- On Tue, 10/28/08, Tyler Littlefield <[EMAIL PROTECTED]> wrote:
From: Tyler Littlefield <[EMAIL PROTECTED]>
Subject: Re: [c-prog] Newbie Newbie C question
To: [email protected]
Date: Tuesday, October 28, 2008, 10:15 PM










    
            hello,

What are you assigning the array as?

For example, what is it's declaration?

Here's a quick example:

#include <string>

int main(void)

{

string arr[2];

arr[0]="Hello" ;

r[1]="World! ";

return 0;

}

HTH,

Thanks,

Tyler Littlefield

email: [EMAIL PROTECTED] com

web: tysdomain-com

Visit for quality software and web design.

skype: st8amnd2005



----- Original Message ----- 

  From: Andre Fecteau 

  To: [EMAIL PROTECTED] com 

  Sent: Tuesday, October 28, 2008 4:07 PM

  Subject: [c-prog] Newbie Newbie C question



Hello Everyone,



I'm really new to c programming, so bear with my simple question. I'm a

  Perl programmer, who has just started learning C(not even experienced

  at Perl). I can get around and usually manage through lots of work to get

  what I need done, done! In Perl I can assign a string to an array element..



ex: $array[0] = "example";



In C it seems that you can only assign an individual letter to each element..



ex: array[0] = 'c';



Whenever I try to do what I do in Perl all the time, in c I get compile

  errors. What am I doing wrong?

  Can I even do this in c?



If you can't do that in c, that's OK. It's just really convenient to do it

  the Perl way!



Thanks,

  Andre



[Non-text portions of this message have been removed]



[Non-text portions of this message have been removed]




      

    
    
        
         
        
        








        


        
        


      

[Non-text portions of this message have been removed]

Reply via email to