Errors in c program -


so here code:

#include <stdio.h> #include <stdlib.h> //funkcija dodavanja u red  void add(cvor* red, int i, cvor broj){ //errors appear in line     red[i] = broj; } // brise iz vadi iz reda clan koji je prvi usao cvor delete(cvor *red, int i){     cvor a;     int e;     = red[0];     (e = 1; e < i;e+=1){         red[e - 1] = red[e];      }     return a; } //definiticja strukture cvora typedef struct temp{     double info;     struct temp* levi;     struct temp* desni;  }cvor;  // pravljenje novog cvora cvor *novi_cvor(cvor *levi_sin,cvor *desni_sin,double broj){     cvor *novi = malloc(sizeof(cvor));     novi->levi = levi_sin;     novi->desni = desni_sin;     novi->info = broj;     return novi;  }  void main(){     int i=0,e,n;     cvor *red;     double broj;     // definisanje reda kao dinamcikog niza     red = calloc(50, sizeof(cvor));     // u red unosimo clanove liste redom      printf("uneti broj clanova liste");     scanf_s("%d", &n);     while (n>0){         scanf_s("%lf", &broj);          add(red, i, *novi_cvor(null,null,broj));         += 1;         n -= 1;     }     //ispis reda     (e = 0; e < i; e += 1){         printf("%2.lf\n\n", red[e]);     }        system("pause"); } 

these errors :

error 1 error c2143: syntax error : missing ')' before '*' error 2 error c2143: syntax error : missing '{' before '*'   error 3 error c2059: syntax error : 'type'   error 4 error c2059: syntax error : ')' 

all of these appears in line 4.

any solutions ? thanks

if want use struct, typedef or method in general in method, have declare or write code up. means when call function delete in main, doesn't detected cvor means, because cvor defined below.

put

typedef struct temp{ double info; struct temp* levi; struct temp* desni; }cvor;  

at first line, before rest.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -