Q 1) In this small snippet
#include <stdio.h>
void passingAddressOfConstants(const int* num1 , int* num2)
{
*num1 = num2;
}
int main(){
const int limit = 100;
int result = 5;
passingAddressOfConstants(&limit,&limit);
}
Error : error: invalid conversion from 'const int*' to 'int*'
Here I defined "limit" is of type const int
but why the error specifies conversion from const int* to int*.
Can someone tell me the reason behind this?
Q 2) Can someone help me to get an example for the below statement
We cannot pass the address of an integer constant to a pointer
to a constant , as this would allow the a constant value to be
modified