[ create a new paste ] login | about

Link: http://codepad.org/GPN97VSw    [ raw code | output | fork ]

C, pasted on Oct 9:
#include <stdio.h>

int main(void) {

        struct bank_account {
                int accountNumber;
                char * firstName;
                char * lastName;
                float balance;
                char * password;
        };



        struct bank_account account_123;
        account_123.accountNumber = 123;
        account_123.firstName = "Oliver";
        account_123.lastName = "Hough";
        account_123.balance = 345.69;
        account_123.password = "f4kep455w0rd";


        display_account();


        printf("\n");
        return 0;
}



int display_account(void) {

        printf("--------------------------------------------------\n");
        printf("                Bank Account Details              \n");
        printf("--------------------------------------------------\n");
        printf(" Account Number: %d\n", account_123.accountNumber);
        printf(" Initials: %c %c\n", account_123.firstName[0], account_123.lastName[0]);
        printf(" First Name: %s\n", account_123.firstName);
        printf(" Last Name: %s\n", account_123.lastName);
        printf(" Balance: €%.2f\n", account_123.balance);
        printf(" Second character of Password: %c\n", account_123.password[1]);
        printf(" Fourth character of Password: %c\n", account_123.password[3]);
        printf(" Seventh character of Password: %c\n", account_123.password[6]);

        return 0;
}


Output:
1
2
3
4
In function 'display_account':
Line 37: error: 'account_123' undeclared (first use in this function)
Line 37: error: (Each undeclared identifier is reported only once
Line 37: error: for each function it appears in.)


Create a new paste based on this one


Comments: