cant find problem

hi i cant seem to find what the problem with the code below is i keep getting the error that i'm missing ';' before type at the first for loop.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "data.h"
void bufferFlush(){
    int c;
    while ((c = getchar()) != '\n' && c != EOF);
}


void getFirstName(char firstName[10]){
    printf("Enter First Name : ");
    scanf_s("%10s", firstName);
    bufferFlush();
}

void getFamilyName(char familyName[20]){
    printf("Enter Family Name : ");
    scanf_s("%20s", familyName);
    bufferFlush();
}


int isValidPhone(char enteredTelephone[20]){
    if(strlen(enteredTelephone)!=10){
        printf("Phone number need to have 10 digits\n");
    }

    for(int i=0;i<10;i++){
        if(!(enteredTelephone[i]>='0' && enteredTelephone[i]<='9')){
            printf("Phone number cant have non numeric characters\n");
        }
    }
    if(enteredTelephone[0]=='0' || enteredTelephone[0]=='1')
    {
        printf("Phone number can not start with 0 or 1\n");
        return 0;
    }
    return 1;
}
void getTelephone(char telephone[10]){
    char enteredTelephone[200];
    printf("Enter Telephone Number : ");
    scanf("%s", enteredTelephone);
    if(!isValidPhone(enteredTelephone)){
        bufferFlush();
        getTelephone(telephone);
    }
    else
    {
        for(int i=0;i<10;i++){
            telephone[i]=enteredTelephone[i];
        }
        telephone[10]='\0';
        bufferFlush();
    }

}




int isInt(char s[100])
{
    for(int i=0;i<strlen(s);i++){
         if(!(s[i]>='0' && s[i]<='9'))
            return 0;
    }
    return 1;

}
int isFloat(char s[100])
{
    int len = (int)strlen(s);
    int countDecimal=0;
    int digitAfterDecimal=0;
    for(int i=0;i<len;i++){
        if(s[i]=='.')
            countDecimal++;
        else if(!(s[i]>='0' && s[i]<='9'))
            return 0;
        if(countDecimal>1)
            return 0;
        if(countDecimal==1){
            digitAfterDecimal++;
        }
    }
    if(digitAfterDecimal>3){
        return 0;
    }
    return 1;

}

void printData(struct person currentPerson){
    printf("%s %-33sTel: %10s",currentPerson.firstName,currentPerson.familyName,currentPerson.telephone);
}


Paste error message...
You did not supply data.h, so it is impossible to duplicate your problem.

Topic archived. No new replies allowed.