C: Output, Variables, Comments

Post Reply
User avatar
Jason
Site Admin
Posts: 749
Joined: Tue Jul 01, 2025 10:13 am

Code: Select all

#include <stdio.h>

#include <string>

// This is a single line comment.

/*  This is a
multiline comment. */

int main(){

char[ ] name = "Amber";

/* Above is a string, but in C, strings are declared as char (character) arrays 
and a <string> library is needed to be declared at the top of the program for it. */

float gpa = 3.5;

int age = 30;

printf("Welcome to Amber's world.");

printf("%s is %d and her GPA is %f.", name, age, gpa, );

return 0;

}


 

POSTREACT(ions) SUMMARY

Post Reply