language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "shellcode.h"
#define TARGET "/tmp/target3"
#define BUFFER 240
#define FP 4
#define RET 4
#define NOP 0x90
#define COUNT_LEN 10
struct widget_t {
double x;
double y;
int count;
};
int main(void)
{
char *args[3];
char *e... |
C |
#include <Evas.h>
#include <stdlib.h>
#include <stdio.h>
#include "volume.h"
#include "database.h"
#include <string.h>
#include <time.h>
static void* _video_files_next(DBIterator* it);
static char db_path[4096];
void database_init(const char* path)
{
snprintf(db_path, sizeof(db_path), "%s", path);
}
/** create a c... |
C | /********** h2.c *********/
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
typedef struct person{
char name[64];
int id;
int age;
char gender;
}PERSON;
int write_sector(int fd, int sector, char *buf)
{
int n;
lseek(fd, sector*512, SEEK_SET); // advan... |
C | /****************************************************************************
* apps/testing/getprime/getprime_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyr... |
C | /**
* Return an array of size *returnSize.
* Note: The returned array must be malloced, assume caller calls free().
*/
int* plusOne(int* digits, int digitsSize, int* returnSize) {
int carry = 1;
for(int i = digitsSize-1;i>=0;--i){
digits[i] = digits[i]+carry;
carry = digits[i]/10;
dig... |
C | #ifndef __ST_TREAP_TREE_H__
#define __ST_TREAP_TREE_H__
#include "stlib.h"
ST_BEGIN_DECLS;
/* ƽ */
/*
* Treap(Sort)һݽṹ(Data Structure)
* reapҶƽ TreapΪ+ Heap˼壬
* Treap BST Heap BSTһ
* ʣĿľΪάƽ⡣ Treap BSTĻϣ
* һֵ BSTʵĻͼ 5 ϣTreapڵ
* ֵС2СʿԱΪÿ
* ڵ㶼Сڵӽڵ㡣ǣ TreapԶΪʵĶ
* 1.գнֵСĸֵ
* ĸڵֵСڵڵֵ
* 2. գнֵĸֵ
* ĸڵֵСڵڵֵ
* ... |
C | #ifndef _CGEOM_LINE_H_
#define _CGEOM_LINE_H_
struct line
{
point a, b;
inline line() : a(0.0, 0.0), b(0.0, 0.0) { }
inline line(const point &_a, const point &_b) : a(_a), b(_b) { }
inline line(double x1, double y1, double x2, double y2) :
a(point(x1, y1)), b(point(x2, y2)) { }
/**
* @brief R... |
C | #include <stdio.h>
int main(){
int a[2][3] = { {6,5,4},{3,2,1} };
printf("[0][0] value is = %d\t",a[0][0]);
printf("[0][1] value is = %d\t",a[0][1]);
printf("[0][2] value is = %d\n",a[0][2]);
printf("[1][0] value is = %d\t",a[1][0]);
printf("[1][1] value is = %d\t",a[1][1]);
pri... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct s_list
{
char *content;
struct s_list *next;
} t_list;
t_list *list_new(char *content)
{
t_list *new;
new = malloc(sizeof(new));
new->content = strdup(content);
... |
C | /*
* rextend.c
*/
#ifndef lint
static const char *rcs_id =
"$Header: /home/pcrtree/SRC.RCS/libs/csf/RCS/rextend.c,v 1.4 1997/10/07 09:45:40 cees Exp $";
#endif
#include "csf.h"
#include "csfimpl.h"
#include <math.h>
static double FmodRound(
double v,
double round)
{
double rVal = fmod(v, round);
if(rVal == ... |
C | #ifndef GEOMETRY_H
#define GEOMETRY_H
/* ============== Vertex ==============
Purpose: Stores properties of each vertex
Use: Used in face structure
==================================== */
struct vertex{
float x,y,z; // position in 3D space
float confidence;
float intensity;
float r,g,b; // Color values
};
... |
C | /* An example of socket client, file transfer server */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#define SERVERPORT 8888
#define MAXBUF 1024
int main(int argc, char* argv[])
{
int so... |
C | #include "clar.h"
#include "util.h"
FILE *fp = NULL;
void test_utils__initialize(void) {
}
void test_utils__cleanup(void) {
// Close anything we left open
if(fp != NULL) {
fclose(fp);
fp = NULL;
}
}
void test_utils__read_line_can_read_a_line(void) {
fp = fopen(CLAR_FIXTURE_PATH "line_with_nl", "r");
cha... |
C | #include <stdio.h>
#include <stdlib.h>
#define N 13
typedef int data_t;
//节点的类型
typedef struct node{
data_t data; //数据段
struct node *next; //地址段
}**HASH_t, linknode_t; //linknode_t <==> struct node
//HASH_t <==> struct node **
//创建N个空链表
HASH_t linknode_create()
{
int i;
HASH_t h = (HASH_t)mal... |
C | #ident "@(#)$Id: item.c,v 1.1 1996/08/14 18:42:27 anton Exp $";
#include "b.h"
static Item_Set fptr;
ItemArray DEFUN_VOID(newItemArray)
{
ItemArray ia;
ia = (ItemArray) zalloc(max_nonterminal *sizeof(*ia));
return ia;
}
ItemArray DEFUN(itemArrayCopy, (src), ItemArray src)
{
ItemArray dst;
dst =... |
C | #define LCD_DAT PORTK // Port K drives LCD data pins~ E~ and RS
#define LCD_DIR DDRK // Direction of LCD port
#define LCD_E 0x02 // E signal
#define LCD_RS 0x01 // RS signal
#define LCD_E_RS 0x03 // assert both E and RS signals
void main (void)
{
char *msg1 = "hello world!";
char *msg2 = "LCD is working!";
openLCD... |
C | // This struct is binary compatible with float[4] and SSE registers:
struct vector {
float x;
float y;
float z;
float w;
}
__attribute__ ((packed))
__attribute__ ((aligned (16)));
// Define cross-platform vector types:
typedef int32_t vec4i __attribute__ ((vector_size(sizeof(int32_t) * 4))) __attribute__ ((aligned... |
C | #include "mlx/mlx.h"
#include "stdio.h"
#include "stdlib.h"
#include "main.h"
typedef struct s_vars {
void *mlx;
void *win;
void *img;
void *img2;
int pos_player_x;
int pos_player_y;
char **tab;
int res_x;
int res_y;
int move_count;
} t_vars;
void ft_find_pos(t_vars *vars)
{
... |
C | //
// module: device tunnel module
// tunnutil.h
// active to builde up tunnel with specified server, multiplex/demutiplex traffice
// from server to local service or vice vera
//
#include <stdio.h> /* printf, scanf, NULL */
#include <stdlib.h> /* malloc, free, rand */
#include <string... |
C | # include "misc.h"
void main(void)
{
FILE *fp;
int boo,count,c,i,inWord;
char filename[80], ynq;
ynq='a';
inWord=0;
while(ynq != 'n')
{
for(i=0;i<=79;i++)
filename[i]='\0';
boo=1;
ynq='a';
count=0;
printf("Hello!\n\n");
printf("Enter the name of the file: ");
while(strlen(gets(filename)) == 0)
... |
C | #include <iostream>
#include<set>
#include<algorithm>
using namespace std;
int main()
{
int t,n,d,i;
set<int>s;
cin>>t;
while(t--)
{
cin>>n;
for(i=0;i<n;i++)
{
cin>>d;
s.insert(d);
}
cout<<s.size()<<endl;
s.c... |
C | /*
* Copyright (C) 2009-2011 by Benedict Paten (benedictpaten@gmail.com)
*
* Released under the MIT license, see LICENSE.txt
*/
#include "cactusFacesTestShared.h"
static bool nestedTest = 0;
void cactusFaceTestSetup(CuTest* testCase) {
if (!nestedTest) {
cactusFacesTestSharedSetup(testCase);
}
}
... |
C | // Test sequences that can use RISBG with a zeroed first operand.
// The tests here assume that RISBLG isn't available.
/* Tests ported from the Llvm testsuite. */
/* { dg-do compile { target s390x-*-* } } */
/* { dg-options "-O3 -march=z10 -mzarch -fno-asynchronous-unwind-tables" } */
#define i64 signed long long
#... |
C | // Raymond Wang - University of Toronto
// APS105
// Lab 7, part 2. Create best AI you can
// Nov. 2013
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
// Initialize Variables
char** board;
char AI, Human;
int* move;
int* move2;
int* move3;
int n, midpoint;
bool depthwarning, offense;
c... |
C | #include <stdio.h>
int stringcmp(char* first, char* second){
int i = 0;
while( (first[i] != 0) && (second[i] != 0) ){
if(first[i] != second[i]){
return 0;
}
i++;
}
if(first[i] == second[i]){
return 1;
} else {
return 0;
}
}
int main(int argc, char* argv[]){
if(argc != 3){
printf("Invalid number ... |
C | #include <stdio.h>
int global_var = 142;
int main() {
int local_var = 5;
printf("Value of global variable is %i\n", global_var);
printf("Value of local variable inside function is %i\n", local_var);
{
int local_var = 10;
printf("Value of local variable inside nested block is %i\n", loc... |
C | #include "channel.h"
char* configFile = "config.conf";
void initializeChannelsAux(FILE* fp, int id);
int getScheduler(char* data);
int getFlow(char* data);
/**
* Funcion encargada de inicializar los canales con los datos leido del archivo de configuracion
*/
void initializeChannels() {
FILE* fp = fopen(configF... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gmp.h>
int main(int argc, char* argv[]) {
mpz_t n;
mpz_t m;
int i;
char* s;
mpz_init(n);
mpz_init(m);
mpz_set_ui(m, 0);
for (i = 1; i < 1001; i++) {
mpz_set_ui(n, i);
mpz_pow_ui(n, n, i);
mpz_add(m, m, n);
}
mpz_clear(n);
s = mp... |
C | /*******************************************************************************
* Author : Jennifer Winer
*
* Project : A DFG Off-Line Task Scheduler for FPGA
* - The Genetic Algorithm for determining the ideal implementation
* for each task's operation
*
* Created : May 16, ... |
C | // ------------------------------------------------------
// ---------- Movement -----------
// ---------- Rescue Robot Code 2016 -----------
// --------- -----------
// ---------- Team: Rory W, Ines K & Joseph F -----------
// ---------- Men... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
int n, k;
if (scanf("%d", &n) && scanf("%d", &k)) {
int *array = (int *)malloc(sizeof(int) * n);
for (int i = 0; i < n; i++) {
if (!scanf("%d", &array[i])) {
exit(0);
}
}
int *k_... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_darray_alloc.c :+: :+: :+: ... |
C | #include <stdlib.h>
#include <stdio.h>
#include "Matrix.h"
int main() {
Matrix* matrix = newMatrix(3, 3, (double []){
1,2,3,
4,5,6,
7,8,9
});
Matrix* matrix2 = newMatrix(3, 1, (double []){
1,
2,
3,
});
Matrix* res;
res = newMatrix_mlt(matrix, m... |
C | /* echo.c
* 13 June 2005
* Scott Bronson
*
* Conveys data between the bgio master and stdin/stdout.
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <assert.h>
#include "log.h"
#include "bgio.h"
#include "fifo.h"
#include "io/io.h"
#include "pipe.h"
#include "task.h"
#in... |
C | #include "acllib.h"
#include <stdio.h>
void mouseListener(int x,int y,int button,int event)
{
static int ox=0;
static int oy=0;
printf("x=%d,y=%d,button=%d,event=%d\n",x,y,button,event);
beginPaint();
line(ox,oy,x,y);
endPaint();
ox=x;oy=y;
}
void keyListener(int key,int event)
{
printf("ket=%d,event=%d... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include<string.h>
#include<time.h>
FILE *fptr,*fmem,*fborrow;
struct book
{
char tittle [128];
char auth[128];
char publisher[128];
char isbn[128];
char date[128];
int copies; //constant
int copiesAvailable;
char category[128];
... |
C | int min(int x, int y)
{
return (x<y)? x: y;
}
/**
* 版本二:非递归实现的归并排序,自底向上
*/
void MergeSort(int *arr, int len)
{
if (NULL == arr || len <= 0) return;
int *tmpArr = malloc(len * sizeof(int));
if (NULL == tmpArr) return;
for (int step = 1; step < len; step *= 2) {
for (int i = 0; i < len; i +=... |
C | #include <stdio.h>
#include <stdlib.h>
#include "solver.h"
#include "readfiles.h"
#include "arvores.h"
#include "tendas.h"
#include "structs.h"
/******************************************************************************
* solve_A()
*
* Arguments: filename - file pointer to write data to.
* L - number of lines... |
C | #define F_CPU 8000000UL // 8 MHz
#include <avr/io.h> // this contains all the IO port definitions
#include <avr/eeprom.h>
#include <avr/sleep.h> // definitions for power-down modes
#include <avr/pgmspace.h> // definitions or keeping constants in program memory
#include <avr/wdt.h>
#include ... |
C | /*
* libspt - Serial Packet Transfer Library
*
* Copyright (C) 2017 Patrick Grosse <patrick.grosse@uni-muenster.de>
*/
/**
* @brief input/output management for serial data streams
* @file serial_io.h
* @author Patrick Grosse <patrick.grosse@uni-muenster.de>
*/
#ifndef LIBSPT_SERIAL_IO_H
#define LIBSPT... |
C | /**************************************************************************//**
* @file fmmod.c
* @brief パス管理機能
*****************************************************************************/
#define _UL_MAIN
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#inc... |
C | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main() {
int nbr,choix;
printf("entrer un annes : ");
scanf("%d",&nbr);
printf("donner le choix \n 1. Mois \n 2:jours \n 3:heures \n 4:minutes \n 5:secondes\n");
scanf(... |
C | #include <stdio.h>
// Function to find the waiting time for all processes
int waitingtime(int proc[], int n,
int burst_time[], int wait_time[]) {
// waiting time for first process is 0
wait_time[0] = 0;
// calculating waiting time
for (int i = 1; i < n; i++)
wait_time[i] = burst_time[i - 1] + wait_time[... |
C | /* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt_private.h"
/**
@file de... |
C | /*
* jdefo002_lab3_part1.c - April 15, 2013
* Name: Joshua DeForest-Williams E-mail jdefo002@ucr.edu
* CS Login: jdefo002
* Partner Name: Ariana DeJaco E-mail:adeja001@ucr.edu
* Lab Section: 022
* Assignment: Lab#3 Exercise#1
* Exercise Description: PB0 and PB1 each connect to an LED, and PB0's
* LED i... |
C | #include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<conio.h>
#include<locale.h>
#include<windows.h>
#include<math.h>
int main() {
srand((unsigned)time(NULL));
setlocale(LC_ALL, "rus");
FILE *f; fopen_s(&f, "input.txt", "r");
int **a, n, i, j, k = 0, o = 1, x, y, d = 1;
fscanf_s(f, "%d", &n); a = new in... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* all_to_b.c :+: :+: :+: ... |
C | /* dfix(x) - integer portion of a real number.
argument x must be a double.
any use of dint.c will find an
include to this file
*/
double dfix(x)
double x;
{
union
{
double a;
char c[8];
} z;
register int n;
int exp,mask=0xff;
z.a = x;
... |
C | /**
* string.h: String library
*
* TODO The current implementation keeps makes a local copy of this library for
* each object file during compilation. Does this make sense? Is there a
* performance gain with this approach (e.g. better cache locality or compiler
* optimizations like inlining for these static funct... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
int main()
{
//open test.txt and creat test.txt
int fd = open("test.txt", O_RDWR|O_CREAT, 0664);
if(fd <0)
{
perror("open");
goto out;
}
//write data to test.txt
unsigned char write_b... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define ROZMIAR 30
struct ksiazka{
char autor[32];
char tytul[63];
unsigned ilosc;
float cena;
};
struct ksiazka magazyn[ROZMIAR];
int i;
int wypelnij_strukture(const char *nazwaPliku)
{
const int max_n = 1000;
char napis[max_n], *result;
FILE* ksiazk... |
C | //program to insert node at middle of LL using one loop
#include<stdio.h>
#include<stdlib.h>
struct Node
{
int data;
struct Node *next;
};
typedef struct Node NODE;
typedef struct Node* PNODE;
typedef struct Node** PPNODE;
void Insert(PPNODE Head,int iNo)
{
PNODE newn = NULL;
newn = (PNODE)... |
C | #include "comm.h"
void init_sem(shared *sh)
{
sem_unlink(SHARED_MUTEX_SEM);
if ((sh->mutex = sem_open(SHARED_MUTEX_SEM, O_CREAT | O_EXCL, 0644, 1)) == SEM_FAILED) {
perror("sem_open error");
exit(1);
}
sem_unlink(SHARED_NOVERFLOW_SEM);
if ((sh->noverflow_mutex = sem_open(SHARED_NO... |
C | /*
** parallax.c for parallax.c in /home/roye_v/delivery/tekadventure
**
** Made by Vincent Roye
** Login <roye_v@epitech.net>
**
** Started on Mon May 22 14:15:12 2017 Vincent Roye
** Last update Sun May 28 12:38:29 2017 Victor Dubret
*/
#include <SFML/Audio.h>
#include <SFML/Graphics.h>
#include <SFML/Graphics/... |
C | #include <stdlib.h>
int ft_is_space(char to_find, char *str)
{
int i;
i = 0;
while (str[i])
{
i++;
if (to_find == str[i])
return (1);
}
return (0);
}
int ft_wordcount(char *str, char *charset)
{
int i;
i = 0;
while (str[i])
{
while (str[i] && (ft_is_space(&str[i], charset)))
i++;
if (str[i... |
C | #include <stdio.h>
#include <stdlib.h>
struct date {
int year;
int month;
int day;
};
struct student {
char name[26];
float time;
int recent_chapter;
struct date last_visit;
};
/**
* Main.
*/
int main () {
//declaring and initializing a variable struct student
struct stu... |
C | #include<stdio.h>
int fibonacci(int x)
{
printf("we are in %d fibonacci\n",x);
if(x>=3)
return fibonacci(x-1)+fibonacci(x-2);
else
return 1;
}
int powf(int x,int n){
if(n>0){
return powf(x,n-1)*x;
}
else
return 1;
}
int main( )
{
//printf("%d\n", fibonacci(15));
int count;
scanf("%d",&count);
for... |
C | #include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include "../Headers/AVL_stop_words.h"
int nodeheight(node *p) {
int hl, hr;
hl = p && p->left ? p->left->height : 0;
hr = p && p->right ? p->right->height : 0;
return hl > hr ? hl + 1 : hr + 1;
}
//Calculate Balance Facto... |
C | /*
=============================================================
Name : laib_8_es2.c
Author : BCPTe
Version : 1.0
Copyright : ++NONE++
Description : Laib_8 Exercise 2 - APA 19/20 PoliTO
=============================================================
*/
#include <stdio.h>
#include <stdlib.h>
... |
C | #include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "semaphore/semaphore.h"
#define PROC_COUNT 10
#define ITERATIONS 10
#define SEMAPHORE_SHARED_FILE "__sem.tmp"
void noop(int sig) {}
void critical_section() {
static int count = 0;
printf("<%d> critic... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <glib.h>
#include <malloc.h>
typedef enum DIR {
NORTH,
SOUTH,
EAST,
WEST
} direction;
typedef struct POINT {
int x;
int y;
} point;
direction change_direction(direction current, char turn)
{
switch (current)
{
case NORTH:... |
C | #include <stdio.h>
#define MAXS 10
char *match(char *s, char ch1, char ch2);
int main()
{
char str[MAXS], ch_start, ch_end, *p;
scanf("%s\n", str);
scanf("%c %c", &ch_start, &ch_end);
p = match(str, ch_start, ch_end);
printf("%s\n", p);
return 0;
}
char *match(char *s, char ch1, char ch2)
... |
C | #include "miniRT.h"
int clamp(int data, int min, int max)
{
if (data > max)
return (max);
if (data < min)
return (min);
return (data);
}
t_color new_color(int r, int g, int b)
{
t_color color;
color.t_rgb.r = clamp(r, 0, 255);
color.t_rgb.g = clamp(g, 0, 255);
color.t_rgb.b = clamp(b, 0, 255);
return (co... |
C | #ifndef FUNCIONES_H_INCLUDED
#define FUNCIONES_H_INCLUDED
/** Suma dos numeros enteros y guarda el resultado de la operacion en resultado
*
* Si no hubo errores devuelve 0.
* En caso de error de overflow devuelve -1.
*/
int sumarEnteros(int primerNumero, int segundoNumero, float* resultado);
/** Resta dos numeros... |
C | #include<stdio.h>
#include<ctype.h>
int main(){
FILE*f1 , *f2;
f1=fopen("studenti.txt","r");
char std;
std=fgetc(f1);
f2=fopen("ex16.txt","w");
while (std != EOF)
{
fputc(toupper(std),f2);
std = fgetc(f1);
}
fclose(f1);
fclose(f2);
}
|
C | /*
Name: parimal kiran muley
Rollno: 588[E]
Problem:
Write a menu-driven program in c to perform addition, subtraction,
division, and the transpose of metrics
1. Addition
2. Subtraction
3. Transpose
4. Division
5. Exit
*/
#include <stdio.h>
int main()
{
int choice; //variable declaration
int i,j,w,x,y,z,n;... |
C | /*
// Try JUST GUESSING E for fist letter, increased other ppls score a shit ton
Authors (group members): Taylor Ertrachter (Leader), Noah Wilson, Matthew Dawson, James Spies
// Email addresses of group members: wilsonn2018@my.fit.edu, tertrachter2017@my.fit.edu, mdawson2018@my.fit.edu, jspies2017@my.fit.edu
G... |
C | #include <stdio.h>
#include <stdbool.h>
#define M 3
#define N 2
// 第1维长度必须留空,但方括号不能省略
// 第2维必须指明长度
int sum(int a[][N], int);
int main(void)
{
int i, j;
int a[M][N];
for(i = 0; i < M; i++)
{
for(j = 0; j < N; j++)
{
a[i][j] = (i + 1) * (j + 1);
}
}
printf("... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "mz/type.h"
#include "mz/logger.h"
#include "test/linkedlist.c"
#include "test/arraylist.c"
char *(*testSuite)(void);
int test_runner(char *desc, char *(*testSuite)(void)) {
char *result = (*testSuite)();
printf("TEST SUITE: %s\n", desc);
print... |
C | /*
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};*/
class Solution {
public:
ListNode* FindKthToTail(ListNode* pListHead, unsigned int k) {
//ÿָKָK
//ȻһߣߵNULLָΪ
ListNode* quick = pListHead, *slow = pListHead;
while (k--)
{
if (quick == NULL)//˵kֵ
{
ret... |
C | #include "save.h"
/* savefile로부터 Player info 읽어오는 함수 */
Player* read_savefile(){
char* originalSaveFilePath = "./savefile/savefile.txt"; // 저장된 savefile 위치
FILE* in;
makeSaveDir(); // savefile directory가 존재하지 않는다면 폴더 생성
if((in = fopen(originalSaveFilePath, "r")) == NULL){ // savefile을 read 모드로 파일을 ... |
C | /*
Problem Statement : Write a program which accept directory name from user and create hole in file if size is
less than 1kb & if it is greater than 1kb then truncate the remaining data.
*/
#include<stdio.h>
#include<dirent.h>
#include<fcntl.h>
#include<unistd.h>
#include<sys/stat.h>
#include<stdlib.h>
#include... |
C | #include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "llist.h"
typedef struct testlist {
struct testlist LIST_HEAD;
char *tstring;
} testlist;
static bool _print_nodes(void * node)
{
testlist * const test_node = (testlist *)node;
putchar(' ');
... |
C | /* First C Program - print "Hello world" */
/* Author: girish date: 01/01/2021 */
#include <stdio.h>
int main() {
printf("Hello world!\n");
return 0;
}
|
C | /**
******************************************************************
* @file norflash_test.c
* @author fire
* @version V1.0
* @date 2018-xx-xx
* @brief nor flash
******************************************************************
* @attention
*
* ʵƽ̨:Ұ i.MXRT1052
* ̳ :http://www.fir... |
C | /*
˼·
1Ŀ룬ĿѸݲ뽨˶
2ӽڵṹ嶨Уÿڵ㶼иָchildren洢һӽڵָ飬numChildren¼²ӽڵ
3ͬıģ弴ɣleft/rightΪforѭchildrenָ
ο
https://leetcode-cn.com/problems/n-ary-tree-preorder-traversal/solution/rong-yi-li-jie-de-cyu-yan-di-gui-by-sleeeeep/
꣺
˼±ĵʵ֣
˼δӲ룬
*/
/**
* Definition for a Node.
* struct Node {
* int val;
* int numChildren;
* ... |
C | #include "test.h"
static pthread_mutexattr_t mxAttr;
/* Prevent optimiser from removing dead or obvious asserts. */
int _optimiseFoil;
#define FOIL(x) (_optimiseFoil = x)
int main() {
int mxType = -1;
assert(FOIL(PTHREAD_MUTEX_DEFAULT) == PTHREAD_MUTEX_NORMAL);
assert(FOIL(PTHREAD_MUTEX_DEFAULT) != PTHR... |
C | // Kernel definition
__global__ void VecAdd(float* A, float* B, float* C)
{
int i = threadIdx.x;
C[i] = A[i] + B[i];
}
int main()
{
...
// Kernel invocation with N threads
VecAdd<<<1, N>>>(A, B, C);
...
}
|
C | #include <stdio.h>
int main(void){
if (1 || 0 && 0) {
printf ("Hello world.\n");
} else {
printf ("False alarm.\n");
}
return 0;
}
|
C | /*
* dac.c
*
* Configure PB.0-7 as an 8 bit dac (bit 0 is the least significant bit)
*/
#include "dac.h"
#include "../tm4c123gh6pm.h"
// ----------dacInit----------
// Initialize 8-bit DAC ports
void DACInit(void) {
// Turn on port A
SYSCTL_RCGCGPIO_R |= 0x02;
__asm{NOP};
__asm{NOP};
// All pi... |
C | /* Graphics Math
http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
http://gpwiki.org/index.php/OpenGL:Tutorials:Using_Quaternions_to_represent_rotation */
#include <math.h>
void gmath_norm_vec(float* vec, float* vec_res) {
float x = vec[0];
float y = vec[1];
float z = vec[2];
float mag = sqr... |
C | #include <stdio.h>
#ifdef WIN32
#include <winsock2.h>
#include <windows.h>
#include <winsock.h>
#else //Linux
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <errno.h>//any useful in Windows?
#defi... |
C | // IFJ14, projekt do predmetu IFJ pre 2BIT 2014/2015 //
/////// Autor: Jan Profant
/////// Filip Badan
/////// Michal Chomo
/////// Tomas Chomo
/////// Findo
#include <stdio.h>
#include <stdlib.h>
#include "list.h"
void varfuncL_init(t_varfunc_list *l)
{
l->First=NULL;
l->Last=NULL;
... |
C | #ifndef __MATHS__
#define __MATHS__
inline double
max(double x0, double x1);
inline double
max(double x0, double x1)
{
return((x0 > x1) ? x0 : x1);
}
#endif
|
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_hex.c :+: :+: :+: ... |
C | #ifndef _DRIVER_H_
#define _DRIVER_H_
#include <cml/cml.h>
#include <Eigen/Dense>
//#ifndef ANDROID
#include <glm/glm.hpp>
//#endif
/**
* Wrapper function that performs all the testing. This is not part of Main.cpp
* because the function can be used on Android here, which doesn't use a
* main() function.
*/
void t... |
C | #include<stdio.h>
#include<stdlib.h>
void func(int n);
void func1(int n);
static int step;
int main()
{
int n;
int i;
printf("enter the number:");
scanf("%d",&n);
for(i=0;i<=5;i++)
{
func(n);
printf("\n");
func1(n);
}
printf("\n");
return 0;
}
void func(int n)
{
//static int step;
//int step=0;
printf(... |
C | /*
* pwm.c
*
* Created on: 20 . 2019 .
* Author: Admin
*
* PWM - PA0 TIM2_CH1
*/
#include "pwm.h"
void PWM_Init() {
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN; // I/O port A clock enable
RCC->APB2ENR |= RCC_APB2ENR_AFIOEN; // Alternate Function I/O clock enable
RCC->APB1ENR |= RCC_APB1ENR_TI... |
C | #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
int main() {
int fd = open("three_fifo", O_RDONLY);
int no_digits = 0;
int no_lowercase = 0;
int no_uppercase = 0;
char message[102];
int i = 0;... |
C | #include <stdio.h>
#define clear() printf("\033[H\033[J")
char * selectArch()
{
int selectVal =0;
int loopWhile =1;
while(loopWhile == 1)
{
banner();
printf(BlueF);
printf("\n");
printf(white);
printf("%s",tbl_procfamily_1);
printf(BlueF);
printf("%s",tbl_procfamily_2);
printf("------------------... |
C | #include <logging.h>
DataFlowException:: DataFlowException(const char *type, const char *error){
sprintf(msg, "(%s): %s", type, error);
Logger::LogEvent(msg);
}
FILE* Logger :: logger = fopen("logger.txt", "w");
void Logger:: LogEvent(const char *event){
//writes message to log file
fprintf(logger, "%... |
C | #include "monty.h"
/**
* parse_command - parses commands from the line op
* @stack: the pointer to the head of the stack
* @op: the line with commands/instructions
* @line_num: a number of the line
*
* Return: void
*/
void parse_command(stack_t **stack, char *op, unsigned int line_num)
{
int i;
instruction_t ... |
C | #include <stdarg.h>
typedef struct
{
int A;
} T;
int g = 0;
T f(int x, ...)
{
va_list ap;
T X;
va_start(ap, x);
X = va_arg(ap, T);
if (X.A != 10) {
g = 1;
return X;
}
X = va_arg(ap, T);
if (X.A != 20) {
g = 2;
return X;
}
va_end(ap);
return X;
}
int main()
{
T X, Y;
X.A = 10;
Y.A = 20;
f(2, ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* service_funcs.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <limits.h>
int retornaMaior(int vet[], int n){
int maior = INT_MIN;
for(int i = 0; i < n; i++){
if(vet[i] > maior) maior = vet[i];
}
return maior;
}
int main(){
int n;
scanf("%d", &n);
int nums[n];
for(int i = 0; i < n; i++){
scanf("%d",... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
int i, j;
char text[200];
char minions[200] = "";
char minion[10]; // useful for intermediate strings
char temp[200];
char dl[1] = "-"; // delimiter
char *split; // split token
// Read the raw text
scanf... |
C | #include <stdio.h>
void get_stuff(char * input);
#define LIM 11
int main(void)
{
char input[LIM];
get_stuff(input);
printf("You entered:\n");
printf("%s", input);
putchar('\n');
return 0;
}
void get_stuff(char input[])
{
printf("Enter stuff: \n");
fgets(input, LIM, stdin);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_instr_ld.c :+: :+: :+: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.