Monday, August 24, 2020

String.c

#include <stdio.h>
#include <cs50.h>

int main(void)
{
      String name = get_string("Please enter your name:");
      printf("Hello, %s\n", name);
}



Source: Harvard, CS50


clang compile error message: hello.c:5:26 ......... this tells you to look on line 5 character 26

 it can't tell you exactly what's wrong, but can tell you approximately where it is happening.....start googling



the printf function taking 2 arguments: printf("hello, %s\n", name);

 source: harvard, CS50



%s -- "place holder" for printf in C

 printf("hello, %s\n", name);


" = " is the "assignment operator" in C

 for example:

String name = get_sting("What's your name?\n")



String name = get_string("What's your name?\n")

 source: Harvard, CS50



get_string("What's your name?\n");

 ask user to enter their name


source: Harvard, CS50