---
title: "Default value of a function pointer in VC"  
description: "Default value of a function pointer in VC"  
author: "Royce Roy"  
published: 2013-02-12  
updated: 2013-02-13  
canonical: https://www.mindstick.com/forum/593/default-value-of-a-function-pointer-in-vc  
category: "visual c++"  
tags: ["visual c++"]  
reading_time: 1 minute  

---

# Default value of a function pointer in VC

Hi!

What is the [default value](https://www.mindstick.com/forum/2035/default-value-when-using-singleordefault) of a [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) [pointer](https://www.mindstick.com/articles/11/pointers) in VC++? (Apparently it can't be [NULL](https://www.mindstick.com/forum/33922/how-to-use-null-coalescing-operator-in-c-sharp), so what is it?)

How is this [program](https://www.mindstick.com/blog/12337/scaling-up-your-mentorship-program) supposed to behave and why?

[struct](https://www.mindstick.com/blog/83/struct-in-c-sharp-dot-net) S { void (*f)(); };

[int](https://www.mindstick.com/forum/159137/how-to-convert-date-int-to-date-in-sql) Main()\
{\
S s = S();\
s.f(); // What is the value of s.f?\
}

Please Help me ASAP!

Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)

## Replies

### Reply by AVADHESH PATEL

Hi Royce!\
According your line of code, object s is zero-initialized which means the function pointer is NULL. struct S { void (*f)(); }; int Main() { S s = S(); if ( s.f == NULL) std::cout << "s.f is NULL" << std::endl; } \
Output: s.f is NULL


---

Original Source: https://www.mindstick.com/forum/593/default-value-of-a-function-pointer-in-vc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
