Thread: help urgently needed!

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    4

    Unhappy help urgently needed!

    Click here to see the code

    Here is the errors that I get:

    --------------------Configuration: lab2 - Win32 Debug--------------------
    Compiling...
    lab2.c
    lab2.c(43) : error C2143: syntax error : missing ';' before 'type'
    lab2.c(44) : error C2143: syntax error : missing ';' before 'type'
    lab2.c(45) : error C2065: 'temp_int' : undeclared identifier
    lab2.c(45) : warning C4047: '=' : 'int ' differs in levels of indirection from 'void *'
    lab2.c(46) : error C2143: syntax error : missing ';' before 'type'
    lab2.c(47) : error C2143: syntax error : missing ';' before 'type'
    lab2.c(52) : error C2065: 'i' : undeclared identifier
    lab2.c(54) : error C2065: 'ptr' : undeclared identifier
    lab2.c(54) : error C2100: illegal indirection
    lab2.c(56) : error C2109: subscript requires array or pointer type
    lab2.c(56) : error C2106: '=' : left operand must be l-value
    lab2.c(57) : error C2100: illegal indirection
    lab2.c(59) : error C2100: illegal indirection
    lab2.c(61) : error C2109: subscript requires array or pointer type
    lab2.c(61) : error C2106: '=' : left operand must be l-value
    lab2.c(62) : error C2100: illegal indirection
    lab2.c(71) : warning C4047: 'return' : 'int *' differs in levels of indirection from 'int '
    Error executing cl.exe.

    lab2.exe - 15 error(s), 2 warning(s)



    I really don't know why I get the missing ';' errors!!! HELP!!!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > char *temp_char;
    > temp_char = malloc((vector_len + 1));
    You're writing C++ here - because you follow it with more variable declarations.
    You can't mix declarations and statements in C.

    > #include <malloc.h>
    You don't need this - malloc is in stdlib.h

    > scanf("%s", &temp_char);
    scanf("%s", temp_char);

    > *ptr++;
    ptr++;
    You're just moving the pointer, you're not interested in the value it points to.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    4

    Thank you SALEM, you are my saviour man!!!

    All working fine!!!

  4. #4
    Registered User pinko_liberal's Avatar
    Join Date
    Oct 2001
    Posts
    284
    Originally posted by Salem
    > char *temp_char;
    > temp_char = malloc((vector_len + 1));
    You're writing C++ here - because you follow it with more variable declarations.
    You can't mix declarations and statements in C.
    http://www.kuro5hin.org/?op=displaystory;sid=2001/2/23/194544/139
    In C99 one can actually , but is there any compiler which fully supports C99 ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Algorithms In C++ (Urgently needed)
    By gameuser in forum C++ Programming
    Replies: 1
    Last Post: 06-02-2009, 04:59 AM
  2. C Programmers needed for Direct Hire positions
    By canefan in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 09-24-2008, 11:55 AM
  3. Help urgently needed, please =(
    By *Michelle* in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 06-03-2003, 07:14 AM
  4. real help needed
    By noob2c in forum C Programming
    Replies: 4
    Last Post: 04-06-2003, 03:54 PM
  5. help urgently needed!
    By meys in forum C Programming
    Replies: 0
    Last Post: 10-15-2001, 12:17 PM