User Profile

Collapse

Profile Sidebar

Collapse
linda7
linda7
Last Activity: Jun 22 '14, 07:29 PM
Joined: Apr 2 '14
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • How to limit the number of integers inputted by the user ?

    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...
    See more | Go to post

  • 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 ??
    See more | Go to post

    Leave a comment:


  • Yes it gives error: "incompatib le type", it is fine I will consider the above solution.

    Thank you so much
    See more | Go to post

    Leave 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 !!
    See more | Go to post

    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);
    ...
    See more | Go to post

    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 !
    See more | Go to post

  • linda7
    replied to Re-size array of integers
    in C
    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;
    ...
    See more | Go to post
    Last edited by Rabbit; May 7 '14, 03:45 PM. Reason: Fixed code tags

    Leave a comment:


  • linda7
    replied to Re-size array of integers
    in C
    Okay let's use static memory allocation, how can I write the code for that ?
    See more | Go to post

    Leave a comment:


  • linda7
    replied to Re-size array of integers
    in C
    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


    Thanks
    See more | Go to post

    Leave a comment:


  • linda7
    started a topic Re-size array of integers
    in C

    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...
    See more | Go to post
    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...
    See more | Go to post

    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 ??
    See more | Go to post

    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 !
    See more | Go to post

    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;
    }
    See more | Go to post

    Leave a comment:


  • I mean can I return an array using pointers? and how ?
    See more | Go to post

    Leave a comment:


  • linda7
    started a topic how to return an array of integer from a function?
    in C

    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
    See more | Go to post
    Last edited by Niheel; Apr 7 '14, 02:43 PM. Reason: Part of question
No activity results to display
Show More
Working...