Thread: I need some help fixing this code.

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    2

    Question I need some help fixing this code.

    I am starting to learn C programming and tried to make something. When I run it the first line goes then it lets the user input. After that it messes up. The rest just quickly says all at once without anymore user input. It returns 0 and I dont understand what is wrong. Here is the code.

    Code:
    #include <studio.h>
    #include <stdlib.h>
    int main()
    {
        int user_conersation;
        int feed1;
        int feed2;
        int feed3;
        int feed4;
        int feed5;
        int feed6;
        int feed7;
        int feed8;
        int feed9;
        int feed10;
        int feed11;
        int feed12;
        printf("Hi.\n");
        scanf("%a"), &user_coversation;
        printf("I really don`t feel like talking\n", user_coversation);
        scanf("%b"), &user_coversation;
        printf("No, seriously I don`t want to talk right now.\n", feed1);
        scanf("%c"), &user_coversation;
        printf("You are really starting to get on my nerves now.\n", feed2);
        scanf("%d"), &user_coversation;
        printf("You`re making me angry. You won`t like me when I`m angry.\n", feed3);
        scanf("%e"), &user_coversation;
        printf("I am gonna go incredible hulk on you.\n", feed4);
        scanf("%f"), &user_coversation;
        printf("You think you are real funny dont you?\n", feed5);
        scanf("%g"), &user_coversation;
        printf("I can do something you don`t know about.\n", feed6);
        scanf("%h"), user_coversation;
        printf("You`re going to make me do it.\n", feed7);
        scanf("%i"), user_coversation;
        printf("One more time and I`m going to do it.\n", feed8);
        scanf("%j"), &user_coversation;
        printf("I`m doing it!\n", feed9);
        scanf("%k"), &user_coversation;
        printf("Why didn`t anything happen?\nIts supposed to make you stop talking to me.\n", feed10);
        scanf("%l"), &user_coversation;
        printf("I know what to do now. Next time I`m doing it.\n", feed11);
        scanf("%m"), &user_coversation;
        printf("I`m serious I`m going to do it.\n", feed12);
        scanf("%n"), &user_coversation;
        printf("There, I did it now what? You forced my hand.\nNow you are officially LOCKED OUT!!");
        getchar();
        return 0;
    }
    It comes back with a SIGSEGV code. I don`t understand it all completely and I reall need help.

  2. #2
    spaghetticode
    Guest
    Well, what's wrong is... basically everything. Where did you learn the usage of printf, scanf and variables from?

  3. #3
    Registered User
    Join Date
    Nov 2011
    Posts
    2

    Arrow I haven`t learned at all

    What I made was on a faint grasp of scanf and printf functions. I relied on the green to tell me if there was anthing wrong with it. That`s why I don`t understand what is wrong now. Can someone tell me exactly what is wrong?

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Mremokid1 View Post
    What I made was on a faint grasp of scanf and printf functions. I relied on the green to tell me if there was anthing wrong with it. That`s why I don`t understand what is wrong now. Can someone tell me exactly what is wrong?
    Exactly what is wrong? You don't know the C programming language is what's wrong...


    Get with your C language documentation and look these things up...

    No offense, but what you have now is pretty bad. You really should spend some time with a good tutorial or book... read the text, do the exercises, page by page... then revisit this idea of yours....

  5. #5
    spaghetticode
    Guest
    Well, as I said... I'd be better off telling you exactly what is right, that's

    Code:
    int main() {
    and

    Code:
        return 0;
    }
    The rest is either wrong or doesn't make sense at all. You really should get a book or at least start the tutorials on this very website.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help in fixing this code..
    By transgalactic2 in forum C Programming
    Replies: 20
    Last Post: 12-13-2008, 06:38 AM
  2. help!!! code needs fixing
    By hockey123 in forum C++ Programming
    Replies: 8
    Last Post: 10-18-2008, 06:02 PM
  3. Fixing old C-style code
    By tunafish in forum C Programming
    Replies: 6
    Last Post: 07-01-2005, 07:24 AM
  4. How would I got about fixing this?
    By SlyMaelstrom in forum C++ Programming
    Replies: 1
    Last Post: 04-23-2005, 05:34 AM
  5. need help fixing up this code in allegro
    By Bobish in forum Game Programming
    Replies: 11
    Last Post: 04-06-2002, 02:50 PM

Tags for this Thread