0

I am a student in a first time c programming class. I amhaving problems getting my initials to print in between Hello and World in my program I am writing. I am not sure if I am declaring the variable the right way. Could you please help??

2
Contributors
6
Replies
7
Views
12 Years
Discussion Span
Last Post by Dave Sinkula
0

But don't i have to declare my initials up top first????

One way:

#include<stdio.h>
  int main( )
  {
    printf("Hello %s World", "your initials");
    return 0;
  }
0

I supposed to alter the hello world program so that it prints my initials in the middle of the screen. it says that i can use any of the escape sequences that help me! What does that mean??

But don't i have to declare my initials up top first????

0

But don't i have to declare my initials up top first????

You can if you want.

#include<stdio.h>
 int main( )
 {
    const char initials[] = "your initials";
    printf("Hello %s World\n", initials);
    return 0;
 }

I supposed to alter the hello world program so that it prints my initials in the middle of the screen. it says that i can use any of the escape sequences that help me! What does that mean??

It means you are expected to run before you can crawl -- nonstandard display manipulation before you know how to declare a variable! Wonderful.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.