Hence your scanf statements inside the loop should be using n – 1 rather than n. When you declare struct Info Student, the valid indexes for that array are zero through studVar – 1, not 1 through studVar. If you anyone can clarify this for me I’d appreciate it. I am not entirely sure why this is happening, and don’t know where to fix it so that it runs the way I want it to. That I got error in my output saying stacked smashing
A stack of plates or a book stack are two common examples of a stack. Think of stack as a collection of items where anything you insert in a stack will be placed at the top and if you need to remove something, it will be removed from the top. Every thing worked fine until I added the last two lines below// A stack is a LIFO (last in first out) data structure. Printf("Enter Last Name for student %i: ", n)
Printf("Enter First Name for student %i: ", n) Printf("How many grades will you read per student (1-10)? ") Printf("How many students will you grade (1-25)? ") Int Exam //This is for something I planned to add later Tumbleweed - iSCSI Initiator Yast Discovery/Connection Locks Up - stack smashing detected I am able to discover the targets and then after I specify the connection information (startup - automatic, authentication by targets) and and hit next (F10) Yast locks up. This is for an assignment,so I am required to have a struct in my program named Info, and inside, it has the char variables “firstName” and “lastName”, int variable “age”, and float variable “average”. For each student I am supposed to supply their first and last name, age, and grade average depending on the number of grades I enter. For each student, I am suppose to enter a number of grades (between 1-10). *** stack smashing detected ***: terminated Aborted(***检测到堆栈损坏***:终止中止)Įnter image description hereI am trying to create a program that allows me to enter grades for a number of students (between 1-25).