Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Write a C program to multiply two integers using pointers.

#include <stdio.h>
 
int main()
{
// Declare 2 numbers
    int num1, num2;
    int    mul;
// Declare 2 integer pointers
    int *ptr1, *ptr2;
 
// Assign numbers address to pointers
    ptr1 = &num1; 
    ptr2 = &num2; 
 
    printf("Please enter two numbers for Multiplication: ");
    scanf("%d%d", ptr1, ptr2);
 
    mul = *ptr1 * *ptr2;
 
    printf("The Multiplication Results are = %d", mul);
 
    return 0;
}
Source by devenum.com #
 
PREVIOUS NEXT
Tagged: #Write #C #program #multiply #integers
ADD COMMENT
Topic
Name
1+2 =