Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6038041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:09:40+00:00 2026-05-23T06:09:40+00:00

I am currently trying to make a very simple C program for school that

  • 0

I am currently trying to make a very simple C program for school that creates an array of m integer n (both of which are defined by user input) and either returns the location of the starts of the array or an error message if the array could not be created. It works perfectly well when compiled using Visual Studio, but when I tried to compile it using gcc it throws me a heap of error messages and I simply have no idea what is causing them.

Source code:

#include <stdio.h>
int *create_array(int n, int initial_value);

int main(){
    int *arr;
int num;
int numOfNum;

printf("Store this integer:\n");
scanf("%d", &num);

printf("Store the integer this amount of time:\n");
scanf("%d", &numOfNum);

arr = create_array(num, 1);

if(arr == NULL) printf("ERROR");
else printf("Array stored in this location: %p", arr);
    return 0;
}
int *create_array(int n, int initial_value){
int *pointer;
int i;

pointer = (int *) malloc(sizeof(int) * 10);

for(i = 0; i < n; i++){
    int *p;
    p = pointer;
    p += n*(sizeof(int));
    *p = initial_value;
    }

return pointer;
}

Error from gcc:

q1.c: In function âmainâ:
q1.c:18: error: missing terminating " character
q1.c:19: error: ânotâ undeclared (first use in this function)
q1.c:19: error: (Each undeclared identifier is reported only once
q1.c:19: error: for each function it appears in.)
q1.c:19: error: expected â)â before âbeâ
q1.c:19: error: missing terminating " character
q1.c:20: error: missing terminating " character
q1.c:21: error: missing terminating " character
q1.c:39: error: expected declaration or statement at end of input
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:09:41+00:00Added an answer on May 23, 2026 at 6:09 am

    Seeing the weird characters “ânotâ” I suspect that you are using a bad file encoding. Try copy pasting the code into a linux file editor and save it from that editor into a new file. Try compiling that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to make a small application that performs different duties. Right now
i am trying to make a very simple bash script to find files matching
I'm trying to implement a very simple strategy class in Objective-C that allows for
I am currently trying to make a navigation-menu where an active-class is applied to
I'm currently trying to read in an XML file, make some minor changes (alter
i'm trying to make the following routes .. and currently i'm going about this
I'm trying to make a Tetris-like game in XNA, and currently I'm thinking of
Recently I was trying to make a calendar application that will display the current
I currently trying to find a solution, how to ensure that a test fails
I'm new to rails and I'm trying to make a help page that just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.