My issue
include
using namespace std;
void printValue(int *ptr) {
if(ptr != nullptr) {
cout << "Value: " << *ptr << endl;
} else {
cout << “Pointer is null.” << endl;
}
}
int main() {
int *number = nullptr; // Pointer is null initially
printValue(number); // This should print “Pointer is null.”
}
Why is this not submittable?
My code
#include <iostream>
using namespace std;
void printValue(int *ptr) {
if(ptr != nullptr) {
cout << "Value: " << *ptr << endl;
} else {
cout << "Pointer is null." << endl;
}
}
int main() {
int *number = nullptr; // Pointer is null initially
printValue(number); // This should print "Pointer is null."
}
Learning course: Learn Programming and Problem Solving using C++
Problem Link: https://www.codechef.com/learn/course/sit-cpp-fall/SITFALL42/problems/CPPFALL273