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 8748495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:32:05+00:00 2026-06-13T12:32:05+00:00

When the arguments of dyn_mat are constants, the code runs through without any error

  • 0

When the arguments of dyn_mat are constants, the code runs through without any error and s1 and s2 do store the input values.

#include<stdio.h>

int main(int argc, char const *argv[])
{
    char *s1, *s2;
    int n1=7, n2=8;
    printf("Enter, %d \n", n1);

    scanf("%s", s1);
    scanf("%s", s2);

    int dyn_mat[155][347];

    return 0;
}

but with arguments as variables, say n1 and n2, scanf reading s1 gives segmentation fault.

  • 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-06-13T12:32:06+00:00Added an answer on June 13, 2026 at 12:32 pm

    why does c allow initialization of string without declaration?

    There is no data type string in C.

    In C one possible way to store a string of characters is using an array of characters, with the last element of this array carring a 0 to indicate the end of this string.

    You program does not declare any array, but just pointers to characters, which have no memory assigned to which you copy data using scanf().

    Your just lucky the program does not crash with the first call to scanf().

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

Sidebar

Related Questions

I have several optional arguments and one of them needs to store multiple values
Can I use default arguments in a constructor like this maybe Soldier(int entyID, int
What are the typical arguments in support of storing combo-box values (static lookup values
Without arguments trap prints the currently set commands for all traps. However, a subshell
When passing arguments to code block that exports results Org-mode fails to export with
I see the following arguments repeated a lot in boilerplate code and yet I
I am running input arguments as a command in my dos batch file as
Possible Duplicate: C void arguments I am looking at some OpenGL graphics code and
This code discussing named arguments in Clojure from The Joy of Clojure: (defn slope
How do I pass arguments using ActionScript's event-listener? I have code, as given below,

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.