I'm writing a pretty simple program, but I faced a problem in limiting user input data. For example, if I have a 2D-array of a certain size and I asked the user to input the array column by column but the problem is when I run the program it mix the numbers together.
what I actually need is to delete the rest of numbers which are not part of this column so if the size=3 and the user input 1 2 3 4 5 I need the program to skip 4 & 5 and...
User Profile
Collapse
Profile Sidebar
Collapse
linda7
Last Activity: Jun 22 '14, 07:29 PM
Joined: Apr 2 '14
Location:
-
How to limit the number of integers inputted by the user ?
-
But I don't need a dynamic array, I just need to make it optional for the user to enter any size of array and then this size become static ( I mean the array become static ), so I don't need to free the memory because no extra memory is available, am I right ?? -
Yes it gives error: "incompatib le type", it is fine I will consider the above solution.
Thank you so muchLeave a comment:
-
error message: subscripted value is neither array nor pointer ( lines 20, 21, 23, 24, 31).
Do I have to use double pointer ( int **a ), I mean is there another way to do this ??
And why it gives these errors !!Leave a comment:
-
Hi
I'm writing a program that creates an identity matrix. when I run this program it gives me an error message.
Any help please !
...Code:#include<stdio.h> #include<stdlib.h> int main () { int i,j,m,n; int a; printf(" Please enter the order of the matrix m x n \n"); scanf("%d%d",&m,&n);Leave a comment:
-
Write a C program to create identity matrix or unit matrix
Hi
I'm writing a program that creates an identity matrix. when I run this program it gives me an error message.
Any help please ! -
I have some errors, could you please check it
...Code:#include <stdio.h> #include <stdlib.h> #define size 4 int main(void) { int list[size][size],i,j; // a[20][20]; maximum size int[][] myArray = { {0,1,2,3}, {3,2,1,0}, {3,5,6,1}, {3,8,3,4} }; int* ptr = malloc(size * sizeof(int)); //&list; for(i = 0; i < size; i++){ for(j = 0;Leave a comment:
-
Okay let's use static memory allocation, how can I write the code for that ?Leave a comment:
-
I don't understand what do you mean by balancing the trade-off !
We didn't study the functions malloc and alloc yet ! so is there a simple way to do it without using malloc ! if not please tell me how to do it using malloc function
ThanksLeave a comment:
-
Re-size array of integers
Hello !
C programmers... I need your help.
I have a question regarding ARRAYS !
How can I resize (zoom in/out by a factor of 0.5 to 2.5) an array(8X8) of (integers) without using malloc function.
Update:
What is the best way to scale a 2D image array? For instance, suppose I have an image of 1024 x 2048 bytes, with each byte being a pixel. Each pixel is a grayscale level from 0 to 255. I...Last edited by Niheel; May 5 '14, 09:34 PM. -
sorry for being late, but I wasn't able to open the internet.
I read the article " Arrays Revealed " but I didn't understand all the points mentioned. For the same program how can I modify the program to return a 2-D array instead of 1-D. If I want to return different grades ( quiz, midterm, final, average ) each one in a column so what shall I do.
Honestly the article I read is really helpful but I didn't get all the points...Leave a comment:
-
there is an error:
[Error] C:\Users\hp\Doc uments\C-Free\Temp\Untit led2.cpp:19: error: return-statement with a value, in function returning 'void'
how the function with void can return an array s ??Leave a comment:
-
I wrote the previous code trying to return an array of grades, but I think its not correct, please check it for me !Leave a comment:
-
Code:double *scores(void) { int i, j; double s[no_students]; printf("The grades are:"); for(i=0; i<no_students; i++) { scanf("%lf", &s[i]); printf("\n"); } return s; }Leave a comment:
-
-
how to return an array of integer from a function?
I have a question regarding C programming course. I would be so glad if you help me. The problem is how to return an array of integer from a function?
I'm writing a C program code to return an array of integers ( grades of students ) to the main function!!
please help me
No activity results to display
Show More
Leave a comment: