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??

Recommended Answers

All 6 Replies

Sure -- post your code within code tags

#include<stdio.h>
int main( )

{
printf("Hello World");
}

One way:

#include<stdio.h>
  int main( )
  {
    printf("Hello %s World", "your initials");
    return 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;
  }

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????

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.