online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> struct accountNum { int sequence; char sAccountNum[16]; }; typedef struct accountNum ACCOUNTNUM; int LastAccountNumber(ACCOUNTNUM* info) { int success = 0; FILE* file = fopen("acctNumbers.dat", "rb"); if (file == NULL) { return -1; // Allows you to document different types of errors } while ((fread(info, sizeof(struct accountNum), 1, file)) == 1) { success = 1; } fclose(file); return success; } int main() { ACCOUNTNUM N[] = {{123, "2022-1"}, {111, "2022-2"}, {321, "2022-3"}}; FILE* file = fopen("acctNumbers.dat", "wb"); fwrite(N, 1, sizeof N, file); fclose(file); ACCOUNTNUM info; if (LastAccountNumber(&info) == 1) // if -1 couldn't open file, if 0 no record read printf("\nAcc No %s", info.sAccountNum); }
{2022-1o2022-2A2022-3

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue