Hi,
I am facing weird problem with C++.
With the below example, the print message supposed to be 'Value=22'. But I am seeing it as 'Value=1".
May I know the reason for it please?
FYI, I am using S32DS for ARM C++ Application.
Thanks,
Hari
#include "S32K148.h" /* include peripheral declarations S32K148 */
#include <stdio.h>
class MyClass
{
public:
int a=10;
MyClass()
{
a += 11;
}
};
MyClass myClass;
void func1(void)
{
int x = ++myClass.a;
printf("Value=%d",x);
}
int main()
{
func1();
while(1);
return 0;
}
已解决! 转到解答。