当我尝试在函数调用中访问我的waypoint struct的成员时,我得到了不同的看似垃圾错误。我把指针搞砸了吗?
的main.c
#include "navagator.h"
int main() {
Waypoint w = {43.36, -75.1};
w.lat = 43.36;
w.lon = -75.1;
Serial.print("\nWaypoint ");
Serial.print((*&w).lat);
nav = new Navagator(&w, 1);
}
navigator.cpp
#include navigator.h
Navagator::Navagator(Waypoint* w, int count) {
Serial.print("Current Loc: ");
Serial.print(w->lat);
Serial.print(", ");
Serial.println(w->lon);
}