online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
// #include <math.h> #include <stdio.h> #include <string.h> // #include <stdlib.h> // #include <assert.h> // #include <limits.h> #include <stdbool.h> #define MAX_SIZE 155555 void get_primes(int* primes, int* primeCount) { bool IsPrime[MAX_SIZE]; memset(IsPrime, true, sizeof(IsPrime)); for (int p = 2; p * p < MAX_SIZE; p++) { if (IsPrime[p] == true) { for (int i = p * p; i < MAX_SIZE; i += p) IsPrime[i] = false; } } int count = 0; for (int p = 2; p < MAX_SIZE; p++) { if (IsPrime[p]) { primes[count] = p; count++; } } *primeCount = count; } int main(){ int t; scanf("%d",&t); for(int a0 = 0; a0 < t; a0++){ int n; scanf("%d",&n); int primes[MAX_SIZE]; int primeCount; get_primes(primes, &primeCount); printf("%d\n", primes[n-1]); } return 0; }

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