project-team-f

project-team-f created by GitHub Classroom


Project maintained by csci3250-2019 Hosted on GitHub Pages — Theme by mattgraham

Introduction

We will work according to the document tasks.md (just in case you don’t know!).

Our team will set up this document (README.md), and include some data in it. We will also create a project board, with Basic Kanban template, and set up automations to it. A code written in C will be created and also included in this document. Finally, we will promote our team’s page!

Code

# include <stdio.h>
# include <string.h> 
void fun(){
    printf("HI! This is a simple function!\n");
}

int main(){
    printf("------------------------------------------------\n");
    printf("-----------Simple Demonstration of C------------\n");
    printf("------------------------------------------------\n");
    printf("Hello World!\n"); //Hello World
    int i;
    for(i=0;i<10;i++) //Simple for loop
    {
        printf("I am %d\n",i);
    } 
    char name[] = "chuckjee"; //array
    if(strcmp(name,"chuckjee")==0) // if...else
    {
        printf("YES, I am %s!\n",name);
    }
    else
    {
        printf("NO, I am not the one you want!\n");
    }
    fun(); // simple function
    int a = 10;
    int * p = &a; // pointer manipulation
    printf("Value of variable a: %d\n", a);
    printf("Address of a: %p\n", &a);
    printf("Value of pointer p pointed to a: %p\n", p);
    printf("Dereference of p pointed to a: %d\n",*p);
    
    int flag;
    printf("Enter a value (1-5): "); // Get user input
    scanf("%d",&flag);
    switch (flag) { // switch statements
        case 1:
            printf("1 is one.\n");
            break;
        case 2:
            printf("2 is two.\n");
            break;
        case 3:
            printf("3 is three.\n");
            break;
        case 4:
            printf("4 is four.\n");
            break;
        case 5:
            printf("5 is five.\n");
            break;
        default:
            printf("Why didn't you input 1-5?"); 
    }

    return 0;
}

Build Status

Contributors

Last updated: 2019-04-24 00:15:46 +0800